﻿@model Forums.Models.ForumCreate

@{
    ViewBag.Title = "Create Forum";
    List<Forums.Models.Permission> plist = Model.PermissionList;
    List<Core.NameId> lYesNo = Core.Tools.YesNo();
}

@section StyleInView {

	.cke_button_ForumHelpCmd .cke_icon
	{
		display: none !important;
	}

	.cke_button_ForumHelpCmd .cke_label
	{
		display: inline !important;
        font-weight: bold;
	}

}

<h1>Create Forum</h1>
<div id="help" title="Forum Formatting Help">
<p>
*bold*<br />
_italics_<br />
+underline+<br />
! Heading 1<br />
!! Heading 2<br />
* Bullet List<br />
** Bullet List 2<br />
# Number List<br />
## Number List 2<br />
[url:Example|http://www.example.com/home.html]<br />
[file:Example|http://www.example.com/files/example.txt]<br />
[image:Example|http://www.example.com/images/example.gif]<br />
{"Do not apply formatting"}
</p>
</div>
@using (Html.BeginForm())
{
    @Html.ValidationSummary(true)
    <table border="0" cellpadding="5" cellspacing="0" width="100%">
    <tr><td valign="top">
    <fieldset>
        <legend>Forum Info</legend>
        @Html.HiddenFor(model => model.BusinessUnitId)
        @Html.HiddenFor(model => model.ParentForumId)
        @Html.HiddenFor(model => model.ForumHomePageId)
    
        <div class="editor-label">
            @Html.LabelFor(model => model.ForumName)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.ForumName)
            @Html.ValidationMessageFor(model => model.ForumName)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.OnMainMenuYN)
        </div>
        <div class="editor-field">
            @Html.DropDownListFor(model => model.OnMainMenuYN,new SelectList(lYesNo,"Id","Name",Model.OnMainMenuYN))
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.AllowAnonymousCommentsYN)
        </div>
        <div class="editor-field">
            @Html.DropDownListFor(model => model.AllowAnonymousCommentsYN,new SelectList(lYesNo,"Id","Name",Model.AllowAnonymousCommentsYN))
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.PermissionId)
        </div>
        <div class="editor-field">
            @Html.DropDownListFor(model => model.PermissionId,new SelectList(plist,"PermissionId","Name",Model.PermissionId))
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.PageName)
        </div>
        <div class="editor-field">
            @Html.TextBoxFor(model => model.PageName, new { size = "50" })
        </div>
    </fieldset>
    </td><td valign="top">
    <fieldset>
    <legend>Meta Information</legend>

        <div class="editor-label">
            @Html.LabelFor(model => model.MetaKeywords)
        </div>
        <div class="editor-field">
            @Html.TextAreaFor(model => model.MetaKeywords, new { rows = "4", cols = "35" })
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.MetaDescription)
        </div>
        <div class="editor-field">
            @Html.TextAreaFor(model => model.MetaDescription, new { rows = "4", cols = "35" })
        </div>
    </fieldset>
    </td></tr>    
    <tr><td colspan="2">
        <div class="editor-field" id="ContentEditor">
            @Html.TextAreaFor(model => model.ContentText, new { cols = "40", rows = "5" })
			<script type="text/javascript">
			//<![CDATA[

			    function ShowHelp(e) {
			        $('#help').dialog('open');
			    }

			    var editor = CKEDITOR.replace('ContentText',
				{
				    toolbar: [['Cut', 'Copy', 'PasteText', '-', 'Undo', 'Redo', '-', 'Find', 'Replace', '-', 'SelectAll', 'ForumHelp']],
				    skin: 'v2',
				    height: '400px',
				    enterMode: CKEDITOR.ENTER_BR,
				    entities: false
				});

			    editor.addCommand('ForumHelpCmd', { exec: ShowHelp });
			    editor.ui.addButton('ForumHelp', {
			        label: 'Forum Formatting Help',
			        command: 'ForumHelpCmd'
			    });

			//]]>
			</script>
        </div>
    </td></tr>
    <tr><td colspan="2">
    &nbsp;
    </td></tr>
    <tr><td colspan="2">
        <input type="submit" value="Create" /> |
        @Html.ActionLink("Back to List", "ForumIndex", new { id = Model.ParentForumId })
    </td></tr>
    </table>
}
<script type="text/javascript" language="javascript">
    $(document).ready(function () {
        $("#help").dialog({ autoOpen: false, width: '350px' });
        $('#ForumName').change(function () {
            var pagename = $('#ForumName').val().toLowerCase().replace(/[^a-z0-9]+/g, " ");
            pagename = "~/" + pagename.trim().replace(/\s+/g, "-") + "/home.html";
            $('#PageName').val(pagename);
        });
    });

</script>

